package com.itbaizhan.cxpt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itbaizhan.cxpt.entity.FileUploadRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface FileUploadRecordMapper extends BaseMapper<FileUploadRecord> {

    /**
     * 查询pdf是否存在
     * @param fileName
     * @param fileSize
     * @return
     */
    @Select("SELECT COUNT(*) > 0 FROM file_upload_record WHERE file_name = #{fileName} and file_size = #{fileSize}")
    boolean existsByFileName(String fileName,Long fileSize);

    /**
     * 根据文件id查询
     * @param fileId
     * @return
     */
    @Select("SELECT * FROM file_upload_record WHERE file_id = #{fileId}")
    FileUploadRecord findByFileId(String fileId);
}